#ifndef __BMI160_H__
#define	__BMI160_H__

/*BMI160 REG TABLE*/
#define BMI160_ADDR			0X68

#define BMI160_PMU_STATUS		0X0C

#define BMI160_GYRO_XOUTL_REG		0X0C	
#define BMI160_GYRO_XOUTH_REG		0X0D	
#define BMI160_GYRO_YOUTL_REG		0X0E	
#define BMI160_GYRO_YOUTH_REG		0X0F	
#define BMI160_GYRO_ZOUTL_REG		0X10	
#define BMI160_GYRO_ZOUTH_REG		0X11

#define BMI160_ACCEL_XOUTL_REG		0X12	
#define BMI160_ACCEL_XOUTH_REG		0X13	
#define BMI160_ACCEL_YOUTL_REG		0X14	
#define BMI160_ACCEL_YOUTH_REG		0X15	
#define BMI160_ACCEL_ZOUTL_REG		0X16	
#define BMI160_ACCEL_ZOUTH_REG		0X17
#define BMI160_FIFO_DATA		0X24

#define BMI160_ACC_CONF			0x40
/* rate 0B1000 100hz*/
#define BMI160_ACC_RANGE		0x41
/*  0B0011:+-2G RANGE;0b0101+-4g;0b1000:+-8g;0b1100:+-16g  */
#define BMI160_GYRO_CONF		0x42
#define BMI160_GYRO_RANGE		0x43

#define BMI160_FIFO_DOWNS		0x45
#define BMI160_FIFO_CONFIG1		0x46
#define BMI160_FIFO_CONFIG2		0x47

#define BMI160_FOC_CONF			0x69
#define BMI160_OFFSET_AX		0X71
#define BMI160_OFFSET_AY		0X72
#define BMI160_OFFSET_AZ		0X73
#define BMI160_OFFSET_GX		0X74
#define BMI160_OFFSET_GY		0X75
#define BMI160_OFFSET_GZ		0X76
#define BMI160_OFFSET_EN		0X77
#define BMI160_CMD			0x7E

#define BMI160CMD_START_FOC		0x03
#define BMI160CMD_ACCEL_NORMAL		0x11
#define BMI160CMD_GYRO_NORMAL		0x15
#define BMI160CMD_FIFO_FLUSH		0xB0
#define BMI160CMD_INT_RESET		0xB1
#define BMI160CMD_SOFTRESET		0xB6


typedef struct 
{
	int x;
	int y;
	int z;
}BMI160_Data;

typedef struct 
{
	int time;
	double x;
	double y;
	double z;
}BMI160_FloatData;

void initBMI160(void);
BMI160_Data BMI160_GetAccel(void);
BMI160_Data BMI160_GetGyro(void);

#endif
